#ifndef TEXTURE2D_H
#define TEXTURE2D_H

#include <QOpenGLTexture>

class Texture2D
{
    friend class ResourceManager;

public:
    Texture2D();
    ~Texture2D();

    // Returns textureId or 0 if it has not yet been created.
    GLuint generate(const QString &file);

    GLuint textureID() const
    {
        if (texture != nullptr)
        {
            return texture->textureId();
        }

        return 0;
    }

    void bind() const
    {
        texture->bind();
    }

public:
    QOpenGLTexture::TextureFormat internal_format;//Format of texture object
    QOpenGLTexture::WrapMode wrap_s;
    QOpenGLTexture::WrapMode wrap_t;
    QOpenGLTexture::Filter filter_min;
    QOpenGLTexture::Filter filter_max;

private:
    QOpenGLTexture *texture;
};

#endif // TEXTURE2D_H
